package com.hjy.user.controller;

import com.hjy.common.result.Result;
import com.hjy.common.result.User;
import com.hjy.user.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sysUser")
public class SysUserController {
    @Autowired
    private SysUserService sysUserService;

    /**
     * 发送手机号
     */
    @GetMapping("/send/{tel}")
    public Result<User> send(@PathVariable("tel") String tel) {
        User user = sysUserService.send(tel);
        return Result.success(user);
    }

    /**
     * 登录
     */
    @PostMapping("/login")
    public Result<User> login(@RequestBody User user) {
        User login = sysUserService.login(user);
        return Result.success(login);
    }

}
